<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            width: 150px;
            height: 150px;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            background: orange;
            position: absolute;
        }
    </style>
</head>
<body style="overflow: hidden;">
    <div class="box"></div>
<script>
    var box = document.querySelector('.box');
    var screenWidth = document.documentElement.clientWidth;
    var screenHeight = document.documentElement.clientHeight;
    var speedX = 20;
    var speedY = 20;
    var timer = null;
    function move() {
        var x = box.offsetLeft + speedX;
        var y = box.offsetTop + speedY;
        if(x > screenWidth - box.offsetWidth || x < 0){
            speedX = -speedX;
        }
        if(y > screenHeight - box.offsetHeight || y < 0){
            speedY = -speedY;
        }
        box.style.left = x + 'px';
        box.style.top  = y + 'px';
    }
    setInterval(move,30)

</script>
</body>
</html>